package com.xj.ideatest.dialog;

import com.xj.ideatest.bean.Djt;
import com.xj.ideatest.utils.DjtUtil;

import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class DjtForm {
    private JButton againBtn;
    private JLabel djtLabel;
    private JPanel root;

    public DjtForm() {
        againBtn.addActionListener(actionEvent -> {
            // JOptionPane.showMessageDialog(root, "已点击");
            Djt djt = DjtUtil.getDjt();
            djtLabel.setText(djt.getId() + "：" + djt.getDjt());
        });
        Djt djt = DjtUtil.getDjt();
        djtLabel.setText(djt.getId() + "：" + djt.getDjt());
    }

    public JComponent getComponent() {
        return root;
    }

    public static void main(String[] args) {
        JFrame frame = new JFrame("MainForm");
        frame.setContentPane(new DjtForm().getComponent());
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(300, 600);
        frame.setVisible(true);
    }
}
